package com.yugao.fintech.antelope.statistic.model.entity;

import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.yugao.fintech.antelope.base.model.BasePO;
import com.yugao.fintech.antelope.base.tenant.core.DataIsolation;
import lombok.Getter;
import lombok.Setter;
import lombok.experimental.Accessors;
import org.springframework.format.annotation.DateTimeFormat;

import java.time.LocalDate;
import java.util.Date;

/**
 * 统计访问数据
 *

 */
@Getter
@Setter
@Accessors(chain = true)
@TableName("stat_access")
@DataIsolation(filterTenant = true, tableName = "stat_access")
public class StatAccess extends BasePO {
    @TableId
	private Long id;
	
	/**
	 * 成功访问量
	 */
	private Long successCount = 0L;

	/**
	 * 失败访问量
	 */
	private Long failCount = 0L;
	
	/**
	 * 统计日期
	 */
	private LocalDate statDate;

	@TableField(fill = FieldFill.INSERT)
	@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
	@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
	private Date createdAt;

	@TableField(fill = FieldFill.UPDATE)
	@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
	@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
	private Date updatedAt;

    public static LambdaQueryWrapper<StatAccess> lqw() {
		return Wrappers.lambdaQuery();
	}

	public static LambdaUpdateWrapper<StatAccess> luw() {
		return Wrappers.lambdaUpdate();
	}
}
